CFLAGS = -c -Os -std=c99 -m32 -Wall -Wshadow -W -Wconversion -Wno-sign-conversion  -fno-stack-protector -fomit-frame-pointer -fno-builtin -fno-common  -ffreestanding  -Wno-unused-parameter -Wunused-variable
ASM_FILE := $(wildcard ./*.asm)
ASM_OBJ_FILE := $(patsubst %.asm,%.o,$(ASM_FILE))
C_FILE := $(wildcard ./*.c)
COBJ_FILE := $(patsubst %.c,%.o,$(C_FILE))
LDFLAGS2 = -static -T hello.lds
OJCYFLAGS	= -S -O binary

%.o: %.asm
	nasm -f elf32 $< -o $@
%.o: %.c
	gcc $(CFLAGS) $^  -o $@
start.elf: $(ASM_OBJ_FILE) $(COBJ_FILE) 
	ld $(LDFLAGS2) $^ -o $@
start.bin: start.elf 
	objcopy $(OJCYFLAGS) $< $@
build: start.bin
clean: 
	rm *.elf -f
	rm *.o -f
	rm *.bin -f